package com.qinggeng.project.api.controller;

import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.project.api.security.annotation.LoginRequired;
import com.qinggeng.project.api.security.utils.ApiUtils;
import com.qinggeng.project.system.service.IUserActivityService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("${apiPath}/userActivity")
@CrossOrigin
public class ApiActivityController{

    @Resource
    private IUserActivityService userActivityService;


    @GetMapping("/listLotteryProportion")
    @LoginRequired
    public AjaxResult listLotteryProportion(){

         List<String> list=  userActivityService.listLotteryProportionMonth();
        return AjaxResult.success(list);
    }
    //转账零钱抽奖 只获取比例
    @GetMapping("/getLotteryProportion")
    @LoginRequired
    public AjaxResult getLotteryProportion(){
        Long userId=ApiUtils.getUserId();
        String proportion=userActivityService.getLotteryProportionMonth(userId);
        return AjaxResult.success(proportion);
    }

    //转盘结束 开始转账零钱
    @GetMapping("/getLotteryProportionMonthUpdateAccount")
    @LoginRequired
    public AjaxResult getLotteryProportionMonthUpdateAccount(){
        Long userId=ApiUtils.getUserId();
        String proportion=userActivityService.getLotteryProportionMonthUpdateAccount(userId);
        return AjaxResult.success(proportion);
    }

    //转账到零钱明细 直接百分百
    @PostMapping("/getLotteryProportion")
    @LoginRequired
    public AjaxResult notIsItAMonthlyLottery(){
        Long userId=ApiUtils.getUserId();
        String proportion=userActivityService.notIsItAMonthlyLottery(userId);
        return AjaxResult.success(proportion);
    }

}
